/*
 * Tab-View
 */
.tab() {
  position: relative;
  top: 0;
  height: 40px;
  max-width: 22em;
  min-width: 7em;
  padding: 0;
  margin: 0;
  background-clip: content-box;
  text-align: center;
  color: @theme-text-color;
  list-style: none;
  border: 1px solid transparent;
  a {
    border: none;
    background: none;
    padding-left: 0;
    border-top: 1px solid transparent;
    white-space: nowrap;
    margin: 0;
    color: @theme-text-color;
    overflow: hidden;
    .tab-active-line {
      position: absolute;
      top: 50%;
      left: 0;
      width: 2px;
      height: 0;
      border-top-left-radius: 4px;
      background: @theme-tab-active-bg;
      .transition(.2s ease);
    }
    .tab-icon {
      margin-right: 10px;
    }
    .tab-close {
      border-radius: 50%;
      padding: 3px 10px 10px;
      margin-left: 10px;
      font-size: 10px;
      position: absolute;
      right: 0;
      top: 10px;
      cursor: pointer;
      opacity: 0;
      z-index: 2;
      color: @theme-text-color;
      .transition-property('opacity');
      .transition-duration(.35s);
      .transition-timing-function(ease);
    }
    &:hover,
    &:focus,
    &:active {
      background: none;
    }
  }
  &:hover {
    a {
      background: none;
      .tab-close {
        opacity: 1;
      }
    }
  }
  &.active {
    background: @theme-tab-active-bg;
    color: lighten(@theme-text-color, 20%);
    border-top-color: lighten(@theme-tab-active-bg, 14%);
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    .tab-active-line {
      top: 1px;
      height: 100%;
      background: @theme-tab-active-line-bg;
    }
  }
  &:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: linear-gradient(to right, transparent 0%, @theme-tab-pane-bg 60%, @theme-tab-pane-bg 100%);
  }
}
.tab-view {
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding: 10px 10px 0 0;
  position: relative;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;

  //vars
  @tab-height: 40px;
  .tab-bar {
    display: flex;
    height: (@tab-height + 4);
    width: 100%;
    position: relative;
    overflow: hidden;
    bottom: -1px;
    z-index: 1;
    flex-basis: @tab-height;
    flex-grow: 0;
    flex-shrink: 0;
    ul {
      display: flex;
      flex-direction: row;
      height: auto;
      width: 100%;
      position: relative;
      border-bottom: none;
      position: relative;
      overflow-x: auto;
      overflow-y: hidden;
      padding-bottom: (@tab-height + 10); //gets rid of the scrollbar showing
      .sortable-placeholder {
        position: relative;
        height: @tab-height;
        width: 0;
        &::after {
          width: 2px;
          height: 100%;
          position: absolute;
          content: " ";
          left: 0;
          top: 0;
          background: @theme-tab-active-line-bg;
        }
        &::before {
          content: " ";
          width: 0;
          height: 0;
          display: block;
          left: 0;
          top: 50%;
          margin-top: -6px;
          position: relative;
          border-top: 8px solid transparent;
          border-bottom: 8px solid transparent;
          border-left: 8px solid @theme-tab-active-line-bg;
        }
      }
      .sortable-helper {
        display: block;
        visibility: visible;
      }
      .tab {
        flex: 1;
        .tab();
      }
    }
  }
  .tab-panes {
    position: relative;
    height: 100%;
    width: 100%;
    border: 1px solid @theme-border-color;
    .no-connections {
      p {
        padding-top: 200px;
        color: lighten(@text-color, 4%);
        font-size: 20px;
        font-weight: 500;
        font-style: italic;
      }
    }
    .tab-pane {
      position: absolute;
      height: 100%;
      width: 100%;
      background: @theme-tab-pane-bg;
      display: none;
      &.active {
        display: block;
      }
      .tab-pane-inner {
        height: 100%;
        width: 100%;
        padding: 20px;
        overflow-y: auto;
        &.query-tab-pane {
          overflow-y: hidden;
        }
        &.settings-tab-pane {
          padding: 0;
        }
      }
    }
  }
}
.ui-sortable-helper {
  background: @theme-tab-active-bg;
  color: lighten(@theme-text-color, 20%);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  .tab-active-line {
    display: none;
  }
  .tab();
}
